package com.huadu.mapper;

import com.huadu.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Map;

/**
 * @date 2024/3/18 21:05
 */
@Mapper
public interface UserMapper {
    /**
     * 根据openid来查询用户
     * @param openid
     * @return
     */
    @Select("select * from user where openid=#{openid}")
    User getByOpenid(String openid);

    /**
     * 插入数据
     * @param user
     */
    void insert(User user);
@Select("select * from user where id=#{id}")
    User getById(Long userId);

    /**
     * 计算新增用户数量和总用户数量
     * @param map
     */
    Integer countByMap(Map map);
}
